#include <iostream>
#include <stack>
#include <unordered_map>
using namespace std;

bool isValidSequence(string r) {
    stack<char> st;
    unordered_map<char, char> mapping = {{')', '('}, {'}', '{'}, {']', '['}, {'>', '<'}};
    for (char a : r) {
        if (mapping.find(a) == mapping.end()) {
            st.push(a);
        } else {
            if (st.empty() || st.top() != mapping[a]) {
                return false;
            }
            st.pop();
        }
    }
    return st.empty();
}

int main() {
    string input;
    cin >> input;
    cout << (isValidSequence(input) ? "True" : "False") << endl;
    return 0;
}
